package com.susu.mybatis.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.susu.mybatis.dao.BookDao;
import com.susu.mybatis.entity.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.ResponseStatus;

import java.util.List;

@Service
public class BookService {


    @Autowired
    private BookDao bookDao;
    public PageInfo getList(Integer pageNum) {
        PageHelper.startPage(pageNum,3,"id desc");
        List<Book> books = bookDao.queryAllBy(new Book());
        return new PageInfo<Book>(books);
    }

    public void delBooks(Integer[] ids) {
        bookDao.deleteById(ids);
    }
}
